package com.lei.videoapp.presenter;

import android.util.Log;

import com.lei.tong.mvp.presenter.BasePresenter;
import com.lei.tong.retrofit.BaseObservable;
import com.lei.tong.retrofit.BaseObserver;
import com.lei.tong.retrofit.NetWorkManger;
import com.lei.videoapp.VideoBean;
import com.lei.videoapp.contract.ShipContract;

import java.util.HashMap;

import io.reactivex.Observer;

public class ShipPresenter extends BasePresenter<ShipContract.Model, ShipContract.View> implements ShipContract.Presenter {
    public ShipPresenter(ShipContract.Model mmodel, ShipContract.View mview) {
        super(mmodel, mview);
    }

    @Override
    public void initdata() {
        HashMap<String, String> map = new HashMap<>();
        map.put("feedId","0");
        map.put("pageCount","10");
        map.put("userId","0");
        new BaseObservable().doit(mmodel.initdata(map),new BaseObserver<VideoBean>(){

            @Override
            public void onNext(VideoBean videoBean) {
                super.onNext(videoBean);
                if (videoBean.toString()!=null){
                    Log.e("ljl", "onNext: "+videoBean.getData().getData().toString() );
                    mview.indata(videoBean.getData().getData().toString());
                }
            }

            @Override
            public void onError(Throwable e) {
                super.onError(e);
                Log.e("ljl", "onError: "+e.getMessage() );
            }
        });
    }

    @Override
    public void destroy() {

    }
}
